package com.itmk.home;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/teacherHome.do")
public class TeacherHomeServlet extends HttpServlet {
     private static final String PREX = "WEB-INF/jsp/teacher";
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method = req.getParameter("method");
        if(method.equals("teacherCourse")){
            teacherCourse(req, resp);
        }else if(method.equals("pointList")){
            pointList(req, resp);
        }
    }

    private void pointList(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher(PREX+"/point_list.jsp").forward(req,resp);
    }

    private void teacherCourse(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher(PREX+"/teacher_course.jsp").forward(req,resp);
    }
}
